﻿<%@ Page Language="C#" MasterPageFile="~/MasterPage/MasterPage.Master" AutoEventWireup="true" CodeBehind="BGM_ExpenseGroup.aspx.cs" Inherits="KPIS.GERP.GBMS.APP_UI.Form.BGM_ExpenseGroup" %>
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>

<%@ Register src="../Controls/Combo/SourceCombo.ascx" tagname="SourceCombo" tagprefix="uc1" %>
<%@ Register src="../Controls/TreeView/TreeViewExpense.ascx" tagname="TreeViewExpense" tagprefix="uc2" %>
<%@ Register src="../Controls/Panel/UserPanel.ascx" tagname="UserPanel" tagprefix="uc3" %>
<%@ Register src="../Controls/Panel/CommandPanel.ascx" tagname="CommandPanel" tagprefix="uc4" %>
<%@ Register src="../Controls/Combo/ExpenseGroupCombo.ascx" tagname="ExpenseGroupCombo" tagprefix="uc5" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<LINK REL="StyleSheet" HREF="../../Styles/StyleSheet.css" TYPE="text/css">

<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" BackgroundPosition="None"  > 
</telerik:RadAjaxLoadingPanel>

<telerik:RadAjaxManager runat="server" ID="RadManager1" DefaultLoadingPanelID="RadAjaxLoadingPanel1">
    <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="CmdCtrl">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="PanelGrid" LoadingPanelID="RadAjaxLoadingPanel1"/>
                    <telerik:AjaxUpdatedControl ControlID="PanelList" LoadingPanelID="RadAjaxLoadingPanel1"/>                    
                    <telerik:AjaxUpdatedControl ControlID="PanelTree" LoadingPanelID="RadAjaxLoadingPanel1"/>                    
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="Grid">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="PanelGrid" LoadingPanelID="RadAjaxLoadingPanel1"/>
                    <telerik:AjaxUpdatedControl ControlID="PanelList" LoadingPanelID="RadAjaxLoadingPanel1"/>
                    <telerik:AjaxUpdatedControl ControlID="CmdCtrl" LoadingPanelID="RadAjaxLoadingPanel1"/>                                               
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="tView">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="PanelGrid" LoadingPanelID="RadAjaxLoadingPanel1"/>
                    <telerik:AjaxUpdatedControl ControlID="PanelList" LoadingPanelID="RadAjaxLoadingPanel1"/>
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="cbSource">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="cbExpenseGroup" LoadingPanelID="RadAjaxLoadingPanel1"/>
                </UpdatedControls>
            </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>

<asp:Label ID="hdSeq" Visible="false" runat="server" Text="" ></asp:Label>

<div class="defaultFont">
<uc4:CommandPanel ID="CmdCtrl" runat="server" />
    <table style="width: 980px; height: 100%">
        
        <tr>
        <%--<td valign = "top">
            <div class="Background260">
                <div class="BackgroundBottom260">
                    <br />
                    <table width="100%">
                        <tr>
                            <td  align="left" valign="top" bgcolor="#7DA5E0" 
                                style="padding: 5px; color: #FFFFFF; font-weight: bold;">
                                ผังงบรายจ่าย 
                            </td>
                        </tr>
                    </table>
                    <asp:Panel ID="PanelTree" runat="server" Height="330px" ScrollBars="Auto">
                        <br />
                        <telerik:RadTreeView ID="tView" runat="server" 
                                DataFieldID="ID" DataValueField="ValueField" DataFieldParentID="Parent"
                                DataTextField="TextField" onnodeclick="tView_NodeClick">
                            <DataBindings>
                                <telerik:RadTreeNodeBinding />
                            </DataBindings>
                        </telerik:RadTreeView>                
                    </asp:Panel>
                </div>
            </div>
        </td>--%>
        <td valign = "top">
                    <br />
                    <table width="100%">
                        <tr>
                            <td  align="left" valign="top" bgcolor="#7DA5E0" 
                                style="padding: 5px; color: #FFFFFF; font-weight: bold;">
                                ตารางแสดงข้อมูลงบรายจ่าย 
                            </td>
                        </tr>
                    </table>
                    <asp:Panel runat="server" ID="panelList" Height="330px" ScrollBars="Auto" Visible="false">
                        <ul class="formList" id="Ul1">      
                            <li><table><tr><td width = "150px">รหัส :</td><td><asp:Label runat="server" ID="lbCode" AssociatedControlID="txtCode"></asp:Label>
                                <asp:TextBox ID="txtCode" runat="server" Visible="false" Width="150px" ValidationGroup="1"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                                    ControlToValidate="txtCode" ErrorMessage="*" SetFocusOnError="True" 
                                    ValidationGroup="1"></asp:RequiredFieldValidator></td></tr></table>
                            </li>
                            <li>
                                <table>
                                    <tr>
                                        <td width = "150px">
                                            รหัสในระบบ GFMIS :
                                        </td>
                                        <td>
                                            <asp:Label runat="server" ID="lbGFMISCode" AssociatedControlID="txtGFMISCode"></asp:Label>
                                            <asp:TextBox ID="txtGFMISCode" runat="server" Visible="false" Width="150px" ValidationGroup="1"></asp:TextBox>
                                            
                                            <input id="hGFMISCode" runat="server" type="hidden" />
                                        </td>
                                    </tr>
                                </table>
                            </li>
                            <li><table><tr><td width = "150px">ชื่อค่าใช้จ่าย :</td><td><asp:Label runat="server" ID="lbName" AssociatedControlID="txtName"></asp:Label>
                            <asp:TextBox ID="txtName" runat="server" Visible="false" Width="300px" ValidationGroup="1"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                                    ControlToValidate="txtName" ErrorMessage="*" SetFocusOnError="True" 
                                    ValidationGroup="1"></asp:RequiredFieldValidator></td></tr></table>
                            </li>               
                            <li><table><tr><td width = "150px" valign="top">คำอธิบาย :</td><td><asp:Label runat="server" ID="lbDescr" AssociatedControlID="txtDescr" ></asp:Label>
                            <asp:TextBox ID="txtDescr" runat="server" Visible="false" TextMode="MultiLine" Height="100" Width="300px"></asp:TextBox>
                            </td></tr></table>
                            </li>
    <%--                       <li><table><tr><td width = "150px" valign="top">แหล่งเงิน :</td><td><asp:Label runat="server" ID="lbSource" AssociatedControlID="cbSource"></asp:Label>
                                <uc1:SourceCombo ID="cbSource" runat="server" />
                            </td></tr></table>
                            </li>  --%>                 
                            <li>
                                <table>
                                    <tr>
                                        <td valign="top" width="150px">
                                            อยู่ภายใต้งบรายจ่าย :</td>
                                        <td>
                                            <asp:Label ID="lbExpenseGroup" runat="server" AssociatedControlID="cbExpenseGroup"></asp:Label>
                                                <uc5:ExpenseGroupCombo ID="cbExpenseGroup" runat="server" />
                                        </td>
                                    </tr>
                                </table>
                            </li>
                            <li class="lastListItem">
                            </li>
                        </ul>
                    </asp:Panel>
                    <asp:Panel ID="panelGrid" runat="server" Height="330px" ScrollBars="Auto" Visible="true">
                        <br />
                        <telerik:RadGrid GroupingSettings-CaseSensitive="false" ID="Grid" runat="server" AllowFilteringByColumn="true" 
                            AllowMultiRowSelection="True" AllowPaging="True" AllowSorting="True" 
                            AutoGenerateColumns="False" EnableAJAX="True" OnItemCommand="Grid_ItemCommand"
                            GridLines="None" PageSize="8" ShowStatusBar="false">
                            <MasterTableView AllowMultiColumnSorting="true" DataKeyNames="Sequence" ClientDataKeyNames="Sequence"
                                Width="100%">
                                <PagerStyle Mode="NextPrevNumericAndAdvanced" />
                                <Columns>
                                    <telerik:GridClientSelectColumn UniqueName="ClientSelectColumn" ItemStyle-Width="30px"
                                     HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center">
                                     </telerik:GridClientSelectColumn>
                                    <telerik:GridBoundColumn AutoPostBackOnFilter="true" 
                                        CurrentFilterFunction="Contains" DataField="Code" 
                                        FilterControlWidth="100%" HeaderStyle-HorizontalAlign="Center" 
                                        HeaderText="รหัส" ItemStyle-Width="100px" ShowFilterIcon="false" ItemStyle-HorizontalAlign="Center"
                                        UniqueName="Code">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn AutoPostBackOnFilter="true" 
                                        CurrentFilterFunction="Contains" DataField="gfmis_code" 
                                        FilterControlWidth="100%" HeaderStyle-HorizontalAlign="Center" HeaderStyle-Width="80px"
                                        HeaderText="รหัส GFMIS" ShowFilterIcon="false" ItemStyle-HorizontalAlign="Left"
                                        UniqueName="gfmis_code">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridTemplateColumn AutoPostBackOnFilter="true" 
                                        CurrentFilterFunction="Contains" DataField="Name" FilterControlWidth="100%" 
                                        HeaderStyle-HorizontalAlign="Center" Visible="false"
                                        ShowFilterIcon="false">
                                        <ItemTemplate>
                                            <asp:Label ID="targetSequence" runat="server" Text='<%# Eval("Sequence") %>'></asp:Label>
                                        </ItemTemplate>
                                        <HeaderStyle HorizontalAlign="Center" />
                                    </telerik:GridTemplateColumn>                                
                                    <telerik:GridTemplateColumn AutoPostBackOnFilter="true" 
                                        CurrentFilterFunction="Contains" DataField="Name" FilterControlWidth="100%" 
                                        HeaderStyle-HorizontalAlign="Center" HeaderText="งบรายจ่าย" 
                                        ShowFilterIcon="false" ItemStyle-Width="200px" UniqueName="Name">
                                        <ItemTemplate>
                                            <asp:LinkButton ID="targetControl" runat="server" CommandName="TargetClick"
                                                Text='<%# Eval("Name") %>'></asp:LinkButton>
                                        </ItemTemplate>
                                        <HeaderStyle HorizontalAlign="Center" />
                                    </telerik:GridTemplateColumn>                                
                                    <telerik:GridBoundColumn AutoPostBackOnFilter="true" 
                                        CurrentFilterFunction="Contains" DataField="Description" 
                                        FilterControlWidth="100%" HeaderStyle-HorizontalAlign="Center" 
                                        HeaderText="คำอธิบาย" ShowFilterIcon="false" UniqueName="Description">
                                    </telerik:GridBoundColumn>
                                </Columns>
                            </MasterTableView>
                            <ClientSettings EnableRowHoverStyle="true" >
                                <Selecting AllowRowSelect="True" />
                                <ClientEvents  />
                            </ClientSettings>
                        </telerik:RadGrid>
                    </asp:Panel>
            
        </td>
        </tr>
    </table>
</div>
</asp:Content>
